home *** CD-ROM | disk | FTP | other *** search
/ PCMania 75 / PCMania CD75_1.iso / lycos / netscape / netcast.z / ncjs10.jar / dialog.js < prev    next >
Text File  |  1997-11-26  |  2KB  |  122 lines

  1. /*
  2.  * dialog.js
  3.  * 
  4.  * Copyright (c) 1997 Netscape Communications Corporation, All Rights Reserved
  5.  * 
  6.  * Utility functions for dealing with dialog boxes in Netcaster
  7.  */
  8.  
  9. var gTabShowing = "";
  10.  
  11. function showTab(tabName)
  12. {
  13.     var tabLayerName;
  14.  
  15.     if (gTabShowing == tabName) {
  16.         return;
  17.     }
  18.  
  19.     if (gTabShowing != "") {
  20.         var tabLayerName = gTabShowing + "Tab";
  21.         
  22.         if (document.layers[gTabShowing].document.hiding) {
  23.             if (!document.layers[gTabShowing].document.hiding())
  24.                 return;
  25.         }
  26.  
  27.         document.layers[gTabShowing].visibility="hide";
  28.  
  29.         if ( document.layers[gTabShowing].hideChildren )
  30.           document.layers[gTabShowing].hideChildren();
  31.  
  32.         document.layers[tabLayerName].clip.height -= 3;
  33.         document.layers[tabLayerName].y += 2;
  34.         document.layers[tabLayerName].clip.width -= 2;
  35.     }
  36.  
  37.     document.layers[tabName].visibility="show";
  38.     if ( document.layers[tabName].showChildren )
  39.       document.layers[tabName].showChildren();
  40.  
  41.     tabLayerName = tabName + "Tab";
  42.     document.layers[tabLayerName].y -= 2;
  43.     document.layers[tabLayerName].clip.height += 3;
  44.  
  45.     if (gTabShowing != "") {
  46.         document.layers[tabLayerName].clip.width += 2;
  47.     }
  48.  
  49.     gTabShowing = tabName;
  50.  
  51.     if (document.layers[gTabShowing].document.showing) {
  52.         document.layers[gTabShowing].document.showing();
  53.     }
  54.  
  55.     return;
  56. }
  57.  
  58. function handleHelp(topic)
  59. {
  60.     if ((topic == null) || (topic == ""))
  61.         topic = "net_main_about";
  62.  
  63.     self.location.href = "nethelp:netscape/netcastr:" + topic;
  64. }
  65.  
  66.  
  67. // handleCancel simply dismisses the dialog, optionally calling
  68. // a callback function.
  69.  
  70.  
  71. function handleCancel()
  72. {
  73.     if (self.closing && self.closing != null) {
  74.         self.closing();
  75.     }
  76.  
  77.     self.close();
  78. }
  79.  
  80.  
  81. function trimString(jsString)
  82. {
  83.     var    tempStr = new java.lang.String(jsString);
  84.     tempStr.trim();
  85.  
  86.     return tempStr.toString();
  87. }
  88.  
  89. function fieldEmpty(field)
  90. {
  91.     if ((field == null) || (field.value == null) || (field.value == ""))
  92.         return true;
  93.  
  94.     var tempStr = trimString(field.value);
  95.  
  96.     if (tempStr == "")
  97.         return true;
  98.     
  99.     return false;
  100. }
  101.  
  102.  
  103. function getKey(e)
  104. {
  105.     alert("The key: " + e.which);
  106.  
  107. }
  108.  
  109. function getDrag(e)
  110. {
  111.     var    fileNames = e.data;
  112.  
  113.     alert("File: " + e.data[0]);
  114.     for (var i=0; i< fileNames.length; i++) {
  115.         alert("Dragged: fileNames[0]");
  116.     }
  117.  
  118.     return false;
  119.  
  120. }
  121.  
  122. void(0);